<template>
  <smart-page>
    <template #search>
      <smart-search :query-array="RECORD_SEARCH" @on-handler="onSearch"/>
    </template>
    <a-table v-model:selectedKeys="selectedKeys"
             :table-layout-fixed="theme.layoutFixed"
             :row-selection="rowSelection"
             :columns="RECORD_COLUMNS"
             :row-key="rowKey"
             :column-resizable="theme.resizable"
             :bordered="theme.bordered"
             :stripe="theme.stripe"
             :sticky-header="theme.sticky"
             :hoverable="theme.hoverAble"
             :pagination="pagination"
             :loading="theme.loading"
             :data="dataSource"
             @page-change="onPageChange"
             @page-size-change="onPageSizeChange">

    </a-table>


  </smart-page>
</template>
<script lang="ts" setup name="pop-activity-attend">
import {onMounted} from 'vue';


import {RECORD_SEARCH} from '../resource/search'
import {RECORD_COLUMNS} from "../resource/colums";
import {TablePage} from "@/libs/core";
import {PopActivityHttp} from "../resource/http";

import router from "@/libs/router";
import {EmptyUtil} from "@/utils";
import {Acl} from "@/libs/acl";

const pageConfig = {title: '参与记录', rowKey: 'id', nameKey: 'title'}
const {getRecordPage} = PopActivityHttp
const tablePage = new TablePage(pageConfig).setFetchXhr(getRecordPage).setPermission(Acl.POP_DIS_BILL_PAGE_LIST);
const {theme, pagination, rowKey, dataSource, rowSelection, selectedKeys} = tablePage
const {onFetch, onPageChange, onPageSizeChange,   onSearch} = tablePage
onMounted(() => {
  const {query} = router.currentRoute.value
  if (EmptyUtil.isNotEmptyObject(query)) {
    tablePage.searchData.value  = {...query}
  }
  
  onFetch()
})
</script>

